import Vue from 'vue';
let RenderPage = Vue.component('render-page',{
    props:{
        pageComponents:{
            type:Array,
            default:()=>{
                return []
            }
        }
    },
    inject:['search'],
    name:'renderPage',
    watch:{
        search(n){
            console.log(n,'搜索填空件');
        }
    },
    render(create){
        let arr = this.pageComponents;
        return create(
            'div',
            {
                className: 'render-page'
            },
            arr.map((item)=>{
                return this.renderPage(create,item)
            })
        );
    },
    methods:{
        renderPage(create,template){
            return create(
                template.template,
                null,
                {
                    className: template.className||'box'
                }
            )
        }
    }

});
export default RenderPage
